<?php if(!IS_AJAX){?>

<include file="Public:header" />
<style>
    @media screen and (max-width:1100px) {
        .tab-1024 table {width:1100px}
        #searchbox{width:160px!important;}
    }
    .states-info i.fa.fa-folder,.states-info i.fa.fa-folder-open,.states-info i.tree-dot{font-size:12px;}
    .adv-table table tbody tr td{padding:8px;vertical-align: middle}
    .btn-ccc{border:1px solid #ccc}
    .btn-ccc:hover{background:#fafafa;}
    .btn-danger{background-color: #fff}
    .pagination{margin:0}
    #dynamic-table td{height:50px}
    #dynamic-table th{padding-top:0;padding-bottom:0;line-height: 50px;height:50px;}

</style>
<div class="row">
  <div class="col-lg-12">
    <div id="container" style="margin-top:0;">
      <div class="panel">
        <div class="panel-heading">
        	<span class="pagetitle">公司员工</span>
        </div>
        <div class="panel-body" style="padding:0 15px 10px;">
			<style>
				/* 人员名片样式 */
                .u6VcSc{color: #212121;min-height: 110px;width: 284px;-webkit-box-sizing: border-box;box-sizing: border-box;padding: 32px 24px 24px 24px;position: relative;}
                .utPnCc{opacity: 1; visibility: visible; width:278px; height:auto;box-shadow: 0 1px 4px 0 rgba(0,0,0,0.14);}
                .E68jgf{padding-top: 28.17%;position: relative;height: 0;width: 100%;overflow: hidden;}
                .E68jgf img{position: absolute;display: block;left: 0;right: 0;top: 0;bottom: 0;width: 100%;height: auto;margin: auto;}
                .CZrKtf{ -webkit-border-radius: 50%;border-radius: 50%;display: inline-block;position: absolute;top: -20px;}
                .Y7OA7b{font: 500 14px Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size: 18px;line-height: 20px;}
                .RJuGvc{font: 400 14px Roboto,RobotoDraft,Helvetica,Arial,sans-serif;min-height: 18px;}
                .VHmGZd{font: 400 12px Roboto,RobotoDraft,Helvetica,Arial,sans-serif;line-height: 18px; padding-top:20px;}
            </style>
          <div class="tab-content directory-info-row" style="margin-top:0;">
            <div class="tab-pane active " id="home">
                <div style="margin:10px 0;">
                    <div style="float:left;">
                        <if condition="getAccessMenu($accessList, 'Intesys', 'Employee', 'delete')">
                        <a href="##" class="btn" id="ajaxlistboxbob" style="float:left;margin-right:5px;border:1px solid #ccc">批量操作</a>
                        <div class="form-group" id="ajaxlistboxboc" style="display:none;float:left;margin-bottom: 0;"><a href="##" class="btn btn-ccc" id="ajaxlistboxsa">全选</a> <a href="##" class="btn btn-ccc" id="ajaxlistboxca">全不选</a> <a href="##" class="btn btn-ccc" id="ajaxlistboxsar">反选</a> <a rel="{:U('delete')}" href="##" class="btn btn-ccc bdeleteBtn" style="margin-right:5px">删除选中</a></div>
                        </if>
                        <div style="float:left;">
                            <select class="form-control " id="status">
                                <option value="-999">全部状态</option>
                                <option value="1">正常</option>
                                <option value="0">离职</option>
                                <option value="2">请假</option>
                                <option value="3">旷工</option>
                                <option value="4">出差</option>
                                <option value="-1">禁用</option>
                            </select>
                        </div>
                        <div class="clearfix"></div>
                    </div>
                    <div style="float:right;">
                        <div style="width:160px;float: left;" id="searchbox">
                            <form id="ajaxlistboxform" action="<?php echo U('index');?>">
                                <input type="hidden" name="status" value="-999">
                                <div class="input-group">
                                    <input type="text" name="keywords" class="form-control" placeholder="搜索关键词">
                                      <span class="input-group-btn">
                                        <button type="button" onClick="$('#ajaxlistboxform').submit();" class="btn btn-default"><i class="fa icon-search"></i></button>
                                      </span>
                                </div>
                            </form>
                        </div>
                        <div style="width:130px;float: right;padding-left:15px;padding-right:15px;">
                            <html:dropdownselect class="memberselect" listloaded="listloaded" selected="" name="member" style="height:33px; width:110px!important;" multi="0" action="{:U('Team/positionlist')}" title="选择员工" placeholder="点击选择部门" />
                            <style>
                                .selectlist{margin:0; padding:0;}
                                .selectlist ul{padding:0}
                                .selectlist li{list-style-type:none; margin:0; padding:0;padding:5px; border-bottom:1px solid #eee; margin:0 8px;}
                                .selectlist li:hover{background:#eee;}
                            </style>
                            <div id="reselectlayout" style="top:0; display:none; left:0; bottom:0; right:0; position:fixed; z-index:9999999;"></div>
                        </div>
                    </div>
                    <div class="clearfix"></div>
                </div>
                <div class="adv-table tab-1024" style="margin-bottom:15px">
                <table  class="display table table-bordered table-hover table-striped" id="dynamic-table" style="margin-bottom:10px;">
                    <thead>
                        <tr>
                            <th style="text-align:center;display:none;">勾选</th>
                            <th  style="text-align: center;"> 工号</th>
                            <th> 部门/职位</th>
                            <th> 姓名</th>
                            <th> 性别</th>
                            <th> 角色</th>
                            <th> 电话</th>
                            <th>员工状态</th>
                            <th>入职时间</th>
                            <if condition="getAccessMenu($accessList, 'Intesys', 'Employee', 'edit')">
                                <th style="text-align: center;">操作</th>
                            </if>
                        </tr>
                    </thead>
                    <tbody class="" id="ajaxlistbox">
                    <?php }?>
                    <?php if(IS_AJAX){?>
                    <empty name="list">
                        <tr><td colspan="10" align="center">暂无数据</td></tr>
                        <else />
                    <volist name="list" id="vo">
                        <tr>
                            <td style="position:relative; display:none;">
                                    <div class="BatchOperation BatchOperationBtn td">
                                        <?php if($vo['id'] != $myid):?>
                                        <input class="checkbox" type="checkbox" name="id[]" value="{$vo.id}" >
                                        <i class="fa icon-check td" style="border:1px solid #aaa"></i>
                                        <div class="fabg td"></div>
                                        <?php endif; ?>
                                    </div>
                            </td>
                            <!--<div class="Y7OA7b"> <a href="javascript:void(0);" class="A1qsEd">{$vo.name}</a>-->
                            <!--<div class="RJuGvc">这个人很懒 什么都没有留下</div>-->
                            <!--<div class="VHmGZd FdEWOb">-->
                            <!--<div>直接上级: {$vo.pname}({$vo.pid})</div>-->
                            <!--<div>QQ: {$vo.QQ}</div>-->
                            <!--<div>Email: {$vo.Email}</div>-->
                            <!--<div>联系电话: {$vo.tel}</div>-->
                            <td style="text-align: center;">{$vo.company_id}</td>
                            <td>
                                {$vo.memberpositionname}
                            </td>
                            <td><span class="text-name">{$vo.name}</span></td>
                            <td>
                                <switch name="vo['sex']">
                                    <case value="1">男</case>
                                    <case value="0">女</case>
                                    <default>男</default>
                                </switch></td>
                            <td>
                                <eq name="vo.isadministrator" value="1">
                                    超级管理员
                                    <else />
                                    {$groupList[$vo['group_id']]}
                                </eq>
                            </td>
                            <td>{$vo.tel}</td>
                            <td>
                                <?php echo $vo['status']=='0' ? '离职' : '';?>
                                <?php echo $vo['status']=='1' ? '正常' : '';?>
                                <?php echo $vo['status']=='2' ? '请假' : '';?>
                                <?php echo $vo['status']=='3' ? '旷工' : '';?>
                                <?php echo $vo['status']=='4' ? '出差' : '';?>
                                <?php echo $vo['status']=='-1' ? '禁用' : '';?>
                            </td>
                            <td>
                                {$vo['reg_time']|date='Y-m-d',###}
                            </td>
                            <if condition="getAccessMenu($accessList, 'Intesys', 'Employee', 'edit')">
                            <td style="width:200px;text-align:center;">
                                <!--增加权限控制2016-11-29 by：zmx-->
                                <if condition="getAccessMenu($accessList, 'Intesys', 'Analysis', 'block')">
                                    <button class="btn btn-success" type="button"  onclick="_openWindow('{:U('Analysis/block',['member'=>$vo['id']])}',900,'【{$vo.name}】的积分','取消',null,'')" <if condition="$i eq 1"> data-position="bottom" data-intro="查看他的积分" </if> >他的积分</button>
                                </if>
                                    <button class="btn btn-success" type="button"  onclick="_openWindow('{:U('Employee/edit',['id'=>$vo['id']])}',300,'修改员工信息【{$vo.name}】','保存',function(){ $('#ajaxlistboxform').submit();return true; },'#container');" <if condition="$i eq 1"> data-position="bottom" data-intro="修改员工信息" </if>>查看修改</button>
                            </td>
                            </if>
                        </tr>
                    </volist>
                    </empty>
                    <?php }?>
                    <?php if(!IS_AJAX){?>
                    </tbody>
                </table>
            </div>
            <div>
                <div style="float:left;width:50%;">
                    <if condition="getAccessMenu($accessList, 'Intesys', 'Member_group', 'add')">
                        <a href="<?php echo U('Employee_add/index'); ?>" class="btn btn-success" style="color:#fff;">增加员工</a>
                        <!--<button class="btn btn-success" type="button" onclick="_openWindow('<?php echo U('Employee/add'); ?>', 650, '增加员工', '保存', function(){ $('#ajaxlistboxform').submit(); }, '');">增加员工</button>-->
                        <button class="btn btn-success" type="button" onclick="_openWindow('<?php echo U('Member_group/invite'); ?>', 650, '生成邀请链接', '保存', null, '');">邀请同事</button>
                    </if>
                </div>
                <div class="PagesBox" style="float:right;width:50%;text-align: right;" id="ajaxlistboxpages"></div>
                <div class="clearfix"></div>
            </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    
  </div>
</div>
<include file="Public:script" /> 
<script src="__PUBLIC__/Intesys/AdminX/js/EmojiPicker/lib/js/nanoscroller.min.js"></script> 
<script src="__PUBLIC__/Intesys/AdminX/js/EmojiPicker/lib/js/tether.min.js"></script> 
<script src="__PUBLIC__/Intesys/AdminX/js/EmojiPicker/lib/js/config.js"></script> 
<script src="__PUBLIC__/Intesys/AdminX/js/EmojiPicker/lib/js/util.js"></script> 
<script src="__PUBLIC__/Intesys/AdminX/js/EmojiPicker/lib/js/jquery.emojiarea.js"></script> 
<script src="__PUBLIC__/Intesys/AdminX/js/EmojiPicker/lib/js/emoji-picker.js"></script> 
<script src="__PUBLIC__/Js/highcharts.src.js"></script>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Intesys/AdminX/js/EmojiPicker/css/default.css">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Admin/bootstrap/css/font-awesome.min.css">
<link href="__PUBLIC__/Intesys/AdminX/js/EmojiPicker/lib/css/nanoscroller.css" rel="stylesheet">
<link href="__PUBLIC__/Intesys/AdminX/js/EmojiPicker/lib/css/emoji.css" rel="stylesheet">
<if condition="getAccessMenu($accessList, 'Intesys', 'Employee', 'missionCheck')">
<script>
    $(".tab-1024").niceScroll({styler:"fb",cursorcolor:"#65cea7", cursorwidth: '5', cursorborderradius: '0px', background: '#424f63', spacebarenabled:false, cursorborder: '0'});
    $.ajax({
        'url' : '{:U('missionCheck')}',
        dataType:"json",
        type:'POST',
        timeout: 30000,
        success:function(ret){
            if(ret.state != 0){
                var d = artDialog({
                            title: '有未审批的员工入职表',
                            content: '<p>' +ret.error+' <a href="{:U('Mission/index',['symbol'=>'1'])}" target="_blank">查看详细</a></p>',
                        cancel: true,
                        effect: true,
                        lock :  true,
                        fixed:  true
            });
                d.show();
            }
        }
    });
</script>
</if>
<script>
    //    {success:function(){ $('[data-toggle="tooltip"]').tooltip(); }, append:true, scrollload:true}//滚动加载
    $('#ajaxlistbox').ajaxlist({loading:'<tr><td colspan="9"><div class="lockwindowlayout" id="lockwindowlayout" style="overflow:hidden; padding:10px 0;"><div class="loader-inner line-scale" style="text-align:center;"><div></div><div></div><div></div><div></div><div></div></div><style>.lockwindowlayout .line-scale{height:20px;}.lockwindowlayout .line-scale div{background:#5ec8ff; height:20px;}</style></div></td></tr>'});
    $('#reselectmember').css('width',$('.memberselect').width());
    function listloaded(){
        $('.memberselect').blur(function(){
            $("#ajaxlistboxform input[name='member_position_id[]']").remove();
            $('.memberselect.binded .itemspan').each(function(){
                $('#ajaxlistboxform').append("<input type='hidden' name='member_position_id[]' value='"+$(this).children("input:eq(1)").attr('value')+"'>");
            });
           $('#ajaxlistboxform').submit();
        });
    }
    $('#status').bind('change',function(){
        $("#ajaxlistboxform input[name='status']").val($(this).children('option:selected').val());
        $('#ajaxlistboxform').submit();
    });
	//部门选择
	function listloaded_position(){
        $('.selectitem').each(function(){
            $(this).click(function(){
                if($(this).prev('em').length==0){
                    $.post("{:U('Member_position/updateMember')}",{ id:$(this).find("input[name='id']").val()},function(data){
                        if(data.status){
                            alert(data.info);
                        }
                    },'json');
                };
            });
        });
	}
</script>
</body></html><?php }?>